package com.financing.wap.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.dao.IBankCardDao;
import com.financing.wap.dto.BankCardDTO;
import com.financing.wap.vo.BingdingCardVO;



@Repository("bankCardDaoImpl")
@SuppressWarnings(value={"unchecked", "deprecation"})
public class BankCardDaoImpl extends BaseDaoImpl<BankCardDTO, java.lang.Integer> implements IBankCardDao {

	@Override
	public List<BankCardDTO> queryBankCardList(BankCardDTO bankCardDTO)
			throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.BANK_CARD_LIST,bankCardDTO);
	}

	@Override
	public int updateBankCard(BankCardDTO bankCardDTO) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.update(SqlName.BANK_CARD_UPDATE, bankCardDTO);
	}

	@Override
	public int insertBankCard(BankCardDTO bankCardDTO) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.BANK_CARD_ADD, bankCardDTO);
	}

	@Override
	public Class<BankCardDTO> getEntityClass() {
		return BankCardDTO.class;
	}

	@Override
	public int deleteBankCard(BankCardDTO bankCardDTO) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.delete(SqlName.BANK_CARD_DELETE,bankCardDTO);
	}

	@Override
	public BankCardDTO queryBankCard(BankCardDTO bankCardDTO)
			throws SQLException {
		
		return (BankCardDTO) this.sqlMapClientTemplate.queryForObject(SqlName.BANK_CARD_INFO,bankCardDTO);
	}

	@Override
	public boolean checkBankType(BankCardDTO bankCardDTO) throws SQLException {
		BankCardDTO bean = (BankCardDTO) this.sqlMapClientTemplate.queryForObject(SqlName.BANK_CARD_INFOFORTYPE,bankCardDTO);
		return bean==null?false:true;
	}

	@Override
	public boolean checkBankName(BankCardDTO bankCardDTO) throws SQLException {
		BankCardDTO bean = (BankCardDTO) this.sqlMapClientTemplate.queryForObject(SqlName.BANK_CARD_CHECK_INFOF,bankCardDTO);
		return bean==null?false:true;
	}

	@Override
	public int countOtherUserBindBankCard(Map<String, Object> map)
			throws SQLException {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.countOtherUserBindBankCard,map);
	}

	@Override
	public List<BingdingCardVO> queryUserBindedcardList(Map<String, Object> map) {
		return this.sqlMapClientTemplate.queryForList(SqlName.FaUserBankCardSql.queryUserBindedcardList,map);
	}


}
